﻿using System;
using System.Collections.Generic;
using System.Text;
using YouHP.Model;
using YouHP.DALFactory;
using System.Data;
using YouHP.Utility;

namespace YouHP.BLL
{
    public class DiseaseBLL
    {

        #region 单件模式
        static DiseaseBLL _Instance;

        public static DiseaseBLL Instance
        {
            get
            {
                if (_Instance == null)
                {
                    _Instance = new DiseaseBLL();
                }
                return _Instance;
            }
        }
        #endregion

        #region 疾病增删改查基本操作
        public bool AddDisease(DiseaseInfo info)
        {
            return DataAccess.DiseaseDAL.AddDisease(info);
        }

        public bool DeleteDisease(int[] dszitemid)
        {
            return DataAccess.DiseaseDAL.DeleteDisease(dszitemid);
        }

        public bool UpdateDisease(DiseaseInfo info)
        {
            return DataAccess.DiseaseDAL.UpdateDisease(info);
        }

#if GENDATA
        public DiseaseInfo GetDiseaseInfo(int did)
        {
            DiseaseInfo info = new DiseaseInfo();
            info.Name = "高血压";
            info.Intro = "高血压病是以体循环动脉压升高为主要表现的临床综合症，是最常见的心血管疾病。病因不明的高血压者称原发性高血压；有明确而独立病因者成为继发性高血压。世界卫生组织建的血压判别标准：①正常血压，收缩压≤18.64Kpa(140mmHg)，舒张压≤12.1Kpa(90mmHg)。②成年人高血压，收缩压≥21.3Kpa(160mmHg)，舒张压≥12.65Kpa(95mmHg)。③临界高血压，指血压介于上述二者之间。";
            info.Id = did;
            info.Desp = "原发性高血压（Primary hyPertension ）是以血压升高为主要临床表现的综合征，通常简称为高血压。高血压是多种心、脑血管疾病的重要病因和危险因素，影响重要脏器例如心，脑、肾的结构与功能，最终导致这些器官的功能衰竭，迄今仍是心血管疾病死亡的主要原因之一";
            return info;
        }
#else
        public DiseaseInfo GetDiseaseInfo(int did)
        {
            return DataAccess.DiseaseDAL.GetDiseaseInfo(did);
        }
#endif
        public int GetDiseaseIdByName(string diseaseName)
        {
            return DataAccess.DiseaseDAL.GetDiseaseIdByName(diseaseName) ;
        }
        #endregion

        #region 疾病列表搜索
        public List<DiseaseInfo> SearchDiseaseByName(int pageSize, int pageIndex, string keyword,out int count)
        {
            return DataAccess.DiseaseDAL.GetDiseaseByName(pageSize, pageIndex, keyword,out count);
        }

        public List<DiseaseInfo> GetDiseaseList(int pageSize, int pageIndex, out int count)
        {
            return DataAccess.DiseaseDAL.GetDiseaseList(pageSize, pageIndex, "", out count);
        }

        public List<DiseaseInfo> GetDiseaseByPinYin(int pageSize, int pageIndex, string pinYin, out int count)
        {
            return DataAccess.DiseaseDAL.GetDiseaseByPinYin(pageSize, pageIndex, pinYin, out count);
        }

        public List<DiseaseInfo> GetDiseaseByType(int pageSize, int pageIndex, int type, out int count)
        {
            return DataAccess.DiseaseDAL.GetDiseaseByType(pageSize, pageIndex, type, out count);
        }

        public List<DiseaseInfo> GetDiseaseByName(int pageSize, int pageIndex, string keyword, out int count)
        {
            return DataAccess.DiseaseDAL.GetDiseaseByName(pageSize, pageIndex, keyword, out count);
        }

        public List<DiseaseInfo> GetAllDiseaseByName(string keyword)
        {
            int count = 0;
            return DataAccess.DiseaseDAL.GetDiseaseByName(Constants.maxPageSize, 1, keyword, out count);
        }

        public List<DiseaseInfo> GetAllDisease()
        {
            return GetAllDiseaseByName("");
        }

#if GENDATA
        /// <summary>
        /// 根据条件获取疾病列表
        /// </summary>
        public List<DiseaseInfo> GetDiseaseList(int pageSize, int pageIndex, DiseaseSearchCondtion dsCond, out int count)
        {

            List<DiseaseInfo> lst = new List<DiseaseInfo>();
            for (int i = 1; i <= pageSize; i++)
            {
                DiseaseInfo info = this.GetDiseaseInfo(i);
                lst.Add(info);
            }
            count = 100;
            return lst;
        }
  
#else
        public List<DiseaseInfo> GetDiseaseList(int pageSize, int pageIndex, DiseaseSearchCondtion dsCond, out int count)
        {
            return DataAccess.DiseaseDAL.GetDiseaseList(pageSize, pageIndex, dsCond.ToSqlConditonString(), out count);
        }
#endif
        

        /// <summary>
        /// 取得Top n 个疾病(按照疾病对应的病人数来降序排列)
        /// </summary>
        public List<DiseaseInfo> GetHottestDisease(int n)
        {
            return DataAccess.DiseaseDAL.GetHottestDiseases(n);
        }

        /// <summary>
        /// 取得Top n 个有此症状的疾病,以及疾病对应的典型病人(按照疾病对应的病人数来降序排列)
        /// </summary>
        public List<DiseaseInfo> GetHottestDiseaseBySymptom(int sympId, int n)
        {
            return DataAccess.DiseaseDAL.GetDiseaseListBySymptomId(sympId, n);
        }

      

        /// <summary>
        /// 取得op n 个可以使用此治疗方案医治的疾病(按照疾病对应的病人数来降序排列)
        /// </summary>
        public List<DiseaseInfo> GetHottestDiseaseByTreatment(int treatmentId, int n)
        {
            return DataAccess.DiseaseDAL.GetDiseaseTreatmentListByTreatmentId(treatmentId,n);
        }
        #endregion 

        #region 疾病类型
        public bool AddDiseaseType(DiseaseTypeInfo info)
        {
            return DataAccess.DiseaseDAL.AddDiseaseType(info);
        }

        public bool UpdateDiseaseType(DiseaseTypeInfo info)
        {
            return DataAccess.DiseaseDAL.UpdateDiseaseType(info);
        }

        public bool DelDiseaseType(int[] itemIds)
        {
            return DataAccess.DiseaseDAL.DelDiseaseType(itemIds);
        }

        public DiseaseTypeInfo GetDiseaseType(int typeId)
        {
            return DataAccess.DiseaseDAL.GetDiseaseType(typeId);
        }

        public List<DiseaseTypeInfo> GetDiseaseTypeList(int parentType)
        {
            return DataAccess.DiseaseDAL.GetDiseaseTypesList(parentType);
        }

        /* 取得所有的疾病类型 */
        public List<DiseaseTypeInfo> GetDiseaseTypeList()
        {
            return DataAccess.DiseaseDAL.GetDiseaseTypesList();
        }

        #endregion

        #region 疾病症状
        /*采用批处理方式来批量增加疾病的相关症状*/
        public bool AddDiseaseSymptom(int diseaseId, List<DiseaseSymptomInfo> symptomList)
        {
            return DataAccess.DiseaseDAL.AddDiseaseSymptom(diseaseId, symptomList);
        }

        /*采用批处理方式来更新疾病的相关症状，说明：先删除老的数据，再添加新的数据*/
        public bool UpdateDiseaseSymptom(int diseaseId, int type, List<DiseaseSymptomInfo> symptomList)
        {
            return DataAccess.DiseaseDAL.UpdateDiseaseSymptom(diseaseId, type, symptomList);
        }

        /*根据疾病症状关联表id删除纪录*/
        public bool DelDiseaseSymptoms(int[] dsIds)
        {
            return DataAccess.DiseaseDAL.DelDiseaseSymptoms(dsIds);
        }

        /*获取疾病相关的所有症状列表，包括主要和次要*/
        public List<DiseaseSymptomInfo> GetDiseaseSymptomList(int dszId)
        {
            return DataAccess.DiseaseDAL.GetDiseaseSymptomList(dszId);
        }

#if GENDATA
        public List<DiseaseSymptomInfo> GetDiseaseSymptomList(int dszId, int type)
        {
            List<DiseaseSymptomInfo> lst = new List<DiseaseSymptomInfo>();
            for (int i = 0; i < 3; i++)
            {
                DiseaseSymptomInfo info = new DiseaseSymptomInfo();
                info.DiseaseName = "疾病";
                info.DiseaseId = dszId;
                info.SymptomId = i + 10;
                info.SymptomName = string.Format("症状 {0} 名称", i);
                lst.Add(info);
            }
            return lst;
        }
#else
        /*获取疾病相关的某种类型的症状列表*/
        public List<DiseaseSymptomInfo> GetDiseaseSymptomList(int dszId, int type)
        {
            return DataAccess.DiseaseDAL.GetDiseaseSymptomList(dszId, type);
        }
#endif

        /*获取编码后的疾病症状信息*/
        public DiseaseSymptoms GetDiseaseSymptoms(int dszId)
        {
            DiseaseSymptoms diseaseSymptoms = new DiseaseSymptoms();

            diseaseSymptoms.DiseaseId = dszId ;
            diseaseSymptoms.DiseaseName = DataAccess.DiseaseDAL.GetDiseaseInfo(dszId).Name ;

            List<DiseaseSymptomInfo> list = DataAccess.DiseaseDAL.GetDiseaseSymptomList(dszId);
            foreach (DiseaseSymptomInfo dsInfo in list)
            {
                if (dsInfo.Type == Constants.PRIMARY_SYMPTOM)
                {
                    if (diseaseSymptoms.DiseasePrimarySymptoms.Length > 0)
                    {
                        diseaseSymptoms.DiseasePrimarySymptoms += "、";
                    }
                    diseaseSymptoms.DiseasePrimarySymptoms += dsInfo.SymptomName;
                }
                else if (dsInfo.Type == Constants.SECOND_SYMPTOM)
                {
                    if (diseaseSymptoms.DiseaseSecondSymptoms.Length > 0)
                    {
                        diseaseSymptoms.DiseaseSecondSymptoms += "、";
                    } 
                    diseaseSymptoms.DiseaseSecondSymptoms += dsInfo.SymptomName;
                }
            }

            return diseaseSymptoms;
        }

        /*获取可选的症状列表（如：type=0，则表示次要症状的可选集*/
        public List<SymptomInfo> GetSelectedSymptomCollect(int diseaseId, int type)
        {
            return DataAccess.DiseaseDAL.GetSelectedSymptomCollect(diseaseId, type);
        }

        public List<SymptomAndIncidenceCount> GetHighIncidenceSymptomsOfDisease(int diseaseId, int count)
        {
            List<SymptomAndIncidenceCount> symptoms =
                DataAccess.DiseaseDAL.GetHighIncidenceSymptomsOfDisease(diseaseId, count);

            for (int index = 0; index < symptoms.Count; index++)
            {
                int symptomId = symptoms[index].SymptomId;
                SymptomInfo symptomInfo = SymptomBLL.Instance.GetSymptomInfo(symptomId);
                symptoms[index].SymptomName = symptomInfo.Name;
            }

            return symptoms;
        }

         // 获得治疗该疾病的几个常用治疗
        public List<TreatmentAndUsedCount> GetMostFrequentUsedTreatmentsOfDisease(int diseaseId, int count)
        {
            List<TreatmentAndUsedCount> treatments =
                 DataAccess.DiseaseDAL.GetMostFrequentUsedTreatmentsOfDisease(diseaseId, count);

            for (int index = 0; index < treatments.Count; index++)
            {
                int treatmentId = treatments[index].TreatmentId;
                TreatmentInfo treatmentInfo = TreatmentBLL.Instance.GetTreatmentInfo(treatmentId);
                treatments[index].TreatmentName = treatmentInfo.Name;
            }

            return treatments;
        }

        // 获得患此种疾病的病人的按地区分布的统计列表
        public List<ProvinceAndPatientCount> GetPatientLocationDistributionStatOfDisease(int diseaseId, int count)
        {
            return DataAccess.DiseaseDAL.GetPatientLocationDistributionStatOfDisease(diseaseId, count);
        }

        #endregion

        #region 疾病治疗
        public bool AddDiseaseTreatment(int diseaseId, List<DiseaseTreatmentInfo> treatmentList)
        {
            return DataAccess.DiseaseDAL.AddDiseaseTreatment(diseaseId, treatmentList);
        }

        public bool DelDiseaseTreatment(int[] dtIds)
        {
            return DataAccess.DiseaseDAL.DelDiseaseTreatments(dtIds);
        }

#if GENDATA
        public List<DiseaseTreatmentInfo> GetDiseaseTreatmentList(int dszId)
        {
            List<DiseaseTreatmentInfo> lst = new List<DiseaseTreatmentInfo>();
            for (int i = 0; i < 5; i++)
            {
                DiseaseTreatmentInfo info = new DiseaseTreatmentInfo();
                lst.Add(info);
                info.TreatmentName = string.Format("治疗名称 {0}",i);
                info.TreatmentId = i * 100 +1;
                info.DiseaseId = dszId;
                info.DiseaseName = "疾病";
                info.Id = 10;
            }
            return lst;
        }
#else 
        public List<DiseaseTreatmentInfo> GetDiseaseTreatmentList(int dszId)
        {
            return DataAccess.DiseaseDAL.GetDiseaseTreatmentList(dszId);
        }
#endif
        public bool UpdateDiseaseTreatment(int diseaseId, List<DiseaseTreatmentInfo> treatmentList)
        {
            return DataAccess.DiseaseDAL.UpdateDiseaseTreatment(diseaseId, treatmentList);
        }

        /*获取编码后的疾病治疗信息*/
        public DiseaseTreatmentsInfo GetDiseaseTreatments(int dszId)
        {
            DiseaseTreatmentsInfo diseaseTreatments = new DiseaseTreatmentsInfo();

            diseaseTreatments.DiseaseId = dszId;
            diseaseTreatments.DiseaseName = DataAccess.DiseaseDAL.GetDiseaseInfo(dszId).Name;

            List<DiseaseTreatmentInfo> list = DataAccess.DiseaseDAL.GetDiseaseTreatmentList(dszId);
            foreach (DiseaseTreatmentInfo dsInfo in list)
            {
                if (diseaseTreatments.DiseaseTreatments.Length > 0)
                {
                    diseaseTreatments.DiseaseTreatments += "、";
                }
                diseaseTreatments.DiseaseTreatments += dsInfo.TreatmentName;
            }

            return diseaseTreatments;
        }
        #endregion

        #region 疾病实验室指标

        /*采用批处理方式来批量增加疾病的相关实验室指标*/
        public bool AddDiseaseLabcheck(int diseaseId, List<DiseaseLabcheckInfo> labcheckList)
        {
            return DataAccess.DiseaseDAL.AddDiseaseLabcheck(diseaseId, labcheckList);
        }

        /*根据疾病实验室指标关联表id删除纪录*/
        public bool DelDiseaseLabcheck(int[] dtIds)
        {
            return DataAccess.DiseaseDAL.DelDiseaseLabchecks(dtIds);
        }

#if GENDATA     
        /*获取疾病相关的所有实验室指标列表*/
        public List<DiseaseLabcheckInfo> GetDiseaseLabcheckList(int dszId)
        {
            List<DiseaseLabcheckInfo> lst = new List<DiseaseLabcheckInfo>();
            DiseaseLabcheckInfo info;

            info = new DiseaseLabcheckInfo();
            lst.Add(info);
            info.Id = 1;
            info.LabcheckId = 1;
            info.LabcheckName = "谷丙转氨酶";
            info.ShortName = "ALT";
            info.GridValues = "10,50,100,200,1000,3000";
            info.NormalValues = "0@40";
            info.ChartIndex = 1;
            info.AxisIndex = 1;
            info.LabcheckUnit = "U/L";
            lst.Add(info);

            info = new DiseaseLabcheckInfo();
            lst.Add(info);
            info.Id = 2;
            info.LabcheckId = 2;
            info.LabcheckName = "谷草转氨酶";
            info.ShortName = "AST";
            info.GridValues = "10,50,100,200,1000,3000";
            info.NormalValues = "0@40";
            info.ChartIndex = 1;
            info.AxisIndex = 2;
            info.LabcheckUnit = "U/L";
            lst.Add(info);

            info = new DiseaseLabcheckInfo();
            lst.Add(info);
            info.Id = 3;
            info.LabcheckId = 3;
            info.LabcheckName = "r谷氨酰转肽酶";
            info.ShortName = "GGT";
            info.GridValues = "10,50,100,200,1000,3000";
            info.NormalValues = "0@55";
            info.ChartIndex = 1;
            info.AxisIndex = 3;
            info.LabcheckUnit = "U/L";

            info = new DiseaseLabcheckInfo();
            lst.Add(info);
            info.Id = 4;
            info.LabcheckId = 4;
            info.LabcheckName = "甘油三酯";
            info.ShortName = "TG";
            info.GridValues = "1,2,3,5,10,50";
            info.NormalValues = "0@1.7";
            info.ChartIndex = 2;
            info.AxisIndex = 1;
            info.LabcheckUnit = "mmol/L";

            info = new DiseaseLabcheckInfo();
            lst.Add(info);
            info.Id = 5;
            info.LabcheckId = 5;
            info.LabcheckName = "甘油三酯";
            info.ShortName = "TC";
            info.GridValues = "3,6,9,12,15,50";
            info.NormalValues = "0@5.7";
            info.ChartIndex = 2;
            info.AxisIndex = 2;
            info.LabcheckUnit = "mmol/L";

            info = new DiseaseLabcheckInfo();
            lst.Add(info);
            info.Id = 6;
            info.LabcheckId = 6;
            info.LabcheckName = "空腹血糖";
            info.ShortName = "FBG";
            info.GridValues = "3,6,9,12,15,50";
            info.NormalValues = "0@5.6";
            info.ChartIndex = 2;
            info.AxisIndex = 3;
            info.LabcheckUnit = "mmol/L";

            return lst;
        }
#else
        public List<DiseaseLabcheckInfo> GetDiseaseLabcheckList(int dszId)
        {
            return DataAccess.DiseaseDAL.GetDiseaseLabcheckList(dszId);
        }
#endif

        /*采用批处理方式来更新疾病的相关实验室指标，说明：先删除老的数据，再添加新的数据*/
        public bool UpdateDiseaseLabcheck(int diseaseId, List<DiseaseLabcheckInfo> labcheckList)
        {
            return DataAccess.DiseaseDAL.UpdateDiseaseLabcheck(diseaseId, labcheckList);
        }

        /*获取编码后的疾病实验室指标信息*/
        public DiseaseLabchecks GetDiseaseLabchecks(int dszId)
        {
            DiseaseLabchecks diseaseLabchecks = new DiseaseLabchecks();

            diseaseLabchecks.DiseaseId = dszId;
            diseaseLabchecks.DiseaseName = DataAccess.DiseaseDAL.GetDiseaseInfo(dszId).Name;

            List<DiseaseLabcheckInfo> list = DataAccess.DiseaseDAL.GetDiseaseLabcheckList(dszId);
            foreach (DiseaseLabcheckInfo dlInfo in list)
            {
                if (diseaseLabchecks.DiseaseLabcheckNames.Length > 0)
                {
                    diseaseLabchecks.DiseaseLabcheckNames += "、";
                }
                diseaseLabchecks.DiseaseLabcheckNames += dlInfo.LabcheckName;
            }

            return diseaseLabchecks;
        }
        #endregion

        #region 疾病图表规则

        public DiseaseGraphSettingInfo GetDiseaseGraphSettingInfo(int diseaseId)
        {
            return DataAccess.DiseaseDAL.GetDiseaseGraphSettingInfo(diseaseId);
        }

        public bool AddDiseaseGraphSetting(DiseaseGraphSettingInfo info)
        {
            return DataAccess.DiseaseDAL.AddDiseaseGraphSetting(info);
        }

        public bool UpdateDiseaseGraphSetting(DiseaseGraphSettingInfo info)
        {
            return DataAccess.DiseaseDAL.UpdateDiseaseGraphSetting(info);
        }

        #endregion

        #region 疾病统计

#if GENDATA
        public List<DiseaseStatRegionInfo> GetDiseaseStatRegion(int did,int regionId)
        {
            string[] city = new string[] {"北京","上海","天津","重庆","福建","浙江","广东","广西","云南","贵州" } ; 
            int[] cnt = new int[] {105,90,95,80,81,86,86,86,86,89};
            List<DiseaseStatRegionInfo> lst = new List<DiseaseStatRegionInfo>();
            for (int i = 0; i < city.Length; i++)
            {
                DiseaseStatRegionInfo info = new DiseaseStatRegionInfo();
                info.PatientCount = cnt[i];
                info.RegionName = city[i];
                info.RegionId = i + 2;
                lst.Add(info);
            }
            return lst;
        }
#else
        /// <summary>
        /// 取得省级或者市级的统计
        /// </summary>
        /// <param name="regionId">上一级的地区Id,对于取省级的统计则regionId=0</param>
        public List<DiseaseStatRegionInfo> GetDiseaseStatRegion(int did,int regionId)
        {
            return DataAccess.DiseaseDAL.GetDiseaseStatRegion(did, regionId);
        }
#endif


#if GENDATA

       public List<DiseaseStatAgeInfo> GetDiseaseStatAge(int did)
       {
           DiseaseStatAgeInfo info = null;
           List<DiseaseStatAgeInfo> statList = new List<DiseaseStatAgeInfo>();
           for (int startAge = 0, endAge = 10, i = 0; i < 8; i++, startAge += 10, endAge += 10)
           {
               info = new DiseaseStatAgeInfo();
               info.Age = string.Format(@"{0}-{1}岁", startAge, endAge);
               info.PatientCount = startAge + 20;

               statList.Add(info);
           }

           //80岁以上
           info = new DiseaseStatAgeInfo();
           info.Age = string.Format(@"{0}岁以上", 80);
           info.PatientCount = 20;

           statList.Add(info);

           return statList;
       }

#else
        /// <summary>
        /// 取得不同分段的年龄统计（采用10年分段）
        /// </summary>
        public List<DiseaseStatAgeInfo> GetDiseaseStatAge(int did)
        {
            DiseaseStatAgeInfo info = null;
            List<DiseaseStatAgeInfo> statList = new List<DiseaseStatAgeInfo>();
            for (int startAge = 0, endAge = 10, i = 0; i < 8; i++, startAge += 10, endAge += 10)
            {
                info = new DiseaseStatAgeInfo();
                info.Age = string.Format(@"{0}-{1}岁", startAge, endAge);
                info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatAge(did, startAge, endAge);

                statList.Add(info);
            }

            //80岁以上
            info = new DiseaseStatAgeInfo();
            info.Age = string.Format(@"{0}岁以上", 80);
            info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatAge(did, 80, -1);

            statList.Add(info);

            return statList;
        }

#endif

       
#if GENDATA
         /// <summary>
        /// 取得患病持续时间分布（小1年，1到3年，3到5年， 5到10年， 大于10年）
        /// </summary>
        public List<DiseaseStatDurationInfo> GetDiseaseStatDuration(int did)
        {
            List<DiseaseStatDurationInfo> statList = new List<DiseaseStatDurationInfo>();

            //小1年
            DiseaseStatDurationInfo info = new DiseaseStatDurationInfo() ;
            info.Duration = "小1年" ;
            info.PatientCount = 20;
            statList.Add(info);

            //1到3年
            info = new DiseaseStatDurationInfo();
            info.Duration = "1到3年";
            info.PatientCount = 10;
            statList.Add(info);

            //3到5年
            info = new DiseaseStatDurationInfo();
            info.Duration = "3到5年";
            info.PatientCount = 40;
            statList.Add(info);

            //5到10年
            info = new DiseaseStatDurationInfo();
            info.Duration = "5到10年";
            info.PatientCount = 60;
            statList.Add(info);

            //大于10年
            info = new DiseaseStatDurationInfo();
            info.Duration = "大于10年";
            info.PatientCount = 90;
            statList.Add(info);

            return statList;
        }

#else
        /// <summary>
        /// 取得患病持续时间分布（小1年，1到3年，3到5年， 5到10年， 大于10年）
        /// </summary>
        public List<DiseaseStatDurationInfo> GetDiseaseStatDuration(int did)
        {
            List<DiseaseStatDurationInfo> statList = new List<DiseaseStatDurationInfo>();

            //小1年
            DiseaseStatDurationInfo info = new DiseaseStatDurationInfo() ;
            info.Duration = "小1年" ;
            info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatDuration(did, 0, 1);
            statList.Add(info);

            //1到3年
            info = new DiseaseStatDurationInfo();
            info.Duration = "1到3年";
            info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatDuration(did, 1, 3);
            statList.Add(info);

            //3到5年
            info = new DiseaseStatDurationInfo();
            info.Duration = "3到5年";
            info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatDuration(did, 3, 5);
            statList.Add(info);

            //5到10年
            info = new DiseaseStatDurationInfo();
            info.Duration = "5到10年";
            info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatDuration(did, 5, 10);
            statList.Add(info);

            //大于10年
            info = new DiseaseStatDurationInfo();
            info.Duration = "大于10年";
            info.PatientCount = DataAccess.DiseaseDAL.GetDiseaseStatDuration(did, 10, -1);
            statList.Add(info);

            return statList;
        }
#endif

#if GENDATA
        public List<DiseaseStatSymptomInfo> GetDiseaseStatSymptom(int did)
        {
            List<DiseaseStatSymptomInfo> statList = new List<DiseaseStatSymptomInfo>();

            //小1年
            DiseaseStatSymptomInfo info = new DiseaseStatSymptomInfo();
            info.SymptomName = "发烧";
            info.SymptomId = 1;
            info.PatientCount = 20;
            statList.Add(info);

            //1到3年
            info = new DiseaseStatSymptomInfo();
            info.SymptomName = "头疼";
            info.SymptomId = 1;
            info.PatientCount = 10;
            statList.Add(info);

            //3到5年
            info = new DiseaseStatSymptomInfo();
            info.SymptomName = "咳嗽";
            info.SymptomId = 1;
            info.PatientCount = 40;
            statList.Add(info);

            return statList;
        }
#else
        public List<DiseaseStatSymptomInfo> GetDiseaseStatSymptom(int did)
        {
            return DataAccess.DiseaseDAL.GetDiseaseStatSymptom(did);
        }
#endif

#if GENDATA
        public List<DiseaseStatTreamentInfo> GetDiseaseStatTreament(int did)
        {
            List<DiseaseStatTreamentInfo> statList = new List<DiseaseStatTreamentInfo>();

            //小1年
            DiseaseStatTreamentInfo info = new DiseaseStatTreamentInfo();
            info.TreamentName = "咳嗽药";
            info.TreamentId = 1;
            info.PatientCount = 20;
            statList.Add(info);

            //1到3年
            info = new DiseaseStatTreamentInfo();
            info.TreamentName = "开博通";
            info.TreamentId = 1;
            info.PatientCount = 10;
            statList.Add(info);

            //3到5年
            info = new DiseaseStatTreamentInfo();
            info.TreamentName = "卡托普利片";
            info.TreamentId = 1;
            info.PatientCount = 40;
            statList.Add(info);

            return statList;
        }
#else
        public List<DiseaseStatTreamentInfo> GetDiseaseStatTreament(int did)
        {
            return DataAccess.DiseaseDAL.GetDiseaseStatTreatment(did);
        }
#endif

        #endregion
    }
}
